const Koa = require('koa')
const cors = require('koa2-cors')
const userRouter = require('./routes/user')
const bodyParser = require('koa-bodyparser')

const app = new Koa()

app.use(bodyParser()) //让koa可以解析post请求接收的参数

app.use(cors())

app.use(userRouter.routes(), userRouter.allowedMethods())

app.listen(3000, () => console.log('服务已启动'))